package cn.ihoway.util;

import cn.ihoway.type.NotifyType;
import com.alibaba.fastjson.JSON;

import java.util.HashMap;

public class HowayMessage {
    private String message;
    private String sender;
    private NotifyType type;
    public HowayMessage(){}
    public HowayMessage(String message){
        this.message = message;
        type = NotifyType.SYSTEM;
    }
    public HowayMessage(NotifyType type,String message){
        this.message = message;
        this.type = type;
    }

    public void setSender(String sender) {
        this.sender = sender;
    }


    @Override
    public String toString() {
        HashMap<String,Object> map = new HashMap<>();
        map.put("message",message);
        map.put("sender",sender);
        map.put("type",type.getType());
        return JSON.toJSONString(map);
    }
}
